package com.andnnl.shudu;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class NumIterTest {

    public static void main(String[] args) {
        List<Integer> mayList = Arrays.asList(1, 2, 3, 4,5,6);
        for (int i = 0; i < mayList.size(); i++) {
            for (int j = i+1; j < mayList.size(); j++) {
                for (int k = j+1; k < mayList.size(); k++) {
                    System.out.println(mayList.get(i)+","+mayList.get(j)+","+mayList.get(k));
                }
            }
        }
        System.out.println("--------------");
        for (int level = 3; level < 4; level++) {
            int n=0;
            List<Integer> rsList=new ArrayList<>();
            sub(mayList,rsList, level,n);
            System.out.println("--------------");
        }

        List<int[]> mayList2=new ArrayList<>();
        int[] aa={1,2};
        mayList2.add(aa);
        for (int[] ints : mayList2) {
            ints[1]=3;
        }
        for (int i : aa) {
            System.out.println(i);
        }
    }

    private static boolean sub(List<Integer> mayList, List<Integer> rsList, int level, int n) {
        if(n==mayList.size())return false;
        boolean rs=false;
        for (int i = n; i < mayList.size(); i++) {
            rsList.add(mayList.get(i));
            if(rsList.size()==level){
                System.out.println(rsList);
                rs=true;
//                return true;
            }else {
                rs=sub(mayList, rsList, level, i + 1);
//                if(rs)
//                    return true;
            }
            rsList.remove(rsList.size()-1);
        }
        return rs;
    }
}
